package com.ruoyi.project.pms.service;

import java.time.LocalDateTime;
import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.db.pms.mapper.PmsCommentMapper;
import com.ruoyi.db.pms.domain.PmsComment;
import com.ruoyi.db.pms.domain.query.PmsCommentQueryVo;

/**
 * 商品评论Service业务层处理
 *
 * @author ruoyi
 * @date 2020-04-20
 */
@Service
public class PmsCommentService
{
    @Autowired
    private PmsCommentMapper pmsCommentMapper;

    /**
     * 查询商品评论
     *
     * @param id 商品评论ID
     * @return 商品评论
     */
    public PmsComment selectPmsCommentById(Long id)
    {
        return pmsCommentMapper.selectPmsCommentById(id);
    }

    /**
     * 查询商品评论列表
     *
     * @param pmsCommentQueryVo 商品评论
     * @return 商品评论
     */
    public List<PmsComment> selectPmsCommentList(PmsCommentQueryVo pmsCommentQueryVo)
    {
        return pmsCommentMapper.selectPmsCommentList(pmsCommentQueryVo);
    }

    /**
     * 新增商品评论
     *
     * @param pmsComment 商品评论
     * @return 结果
     */
    public int insertPmsComment(PmsComment pmsComment)
    {
        return pmsCommentMapper.insertPmsComment(pmsComment);
    }

    /**
     * 新增商品评论回复
     *
     * @param pmsComment 商品评论回复
     * @return 结果
     */
    public int insertPmsReplyComment(PmsComment pmsComment)
    {
        return pmsCommentMapper.insertPmsComment(pmsComment);
    }

    /**
     * 修改商品评论
     *
     * @param pmsComment 商品评论
     * @return 结果
     */
    public int updatePmsComment(PmsComment pmsComment)
    {
        pmsComment.setUpdateTime(LocalDateTime.now());
        return pmsCommentMapper.updatePmsComment(pmsComment);
    }

    /**
     * 批量删除商品评论
     *
     * @param ids 需要删除的商品评论ID
     * @return 结果
     */
    public int deletePmsCommentByIds(Long[] ids)
    {
        return pmsCommentMapper.deletePmsCommentByIds(ids);
    }

    /**
     * 删除商品评论信息
     *
     * @param id 商品评论ID
     * @return 结果
     */
    public int deletePmsCommentById(Long id)
    {
        return pmsCommentMapper.deletePmsCommentById(id);
    }
}
